use "$project_path/data/4_regdata/regdata.dta", clear

* Figure B.3(a)
binscatter growth_gdpc_penn_1lag runvar if abs(runvar)<=30, nbins(16) legend(off) title("GDP per capita growth", size(huge)) xtitle("Margin of victory of the challenger", size(vlarge)) ytitle("Value on the year before the election", size(vlarge)) xlabel(-30(10)30, labsize(vlarge) nogrid) ylabel(, labsize(vlarge) nogrid) line(none)  msymbols(circle)
graph export "$project_path/output/appendix_figures/Appendix_Figure_B3a.pdf", as(pdf) name("Graph") replace

* Figure B.3(b)
binscatter inflation_imf_1lag runvar if abs(runvar)<=30, nbins(16) legend(off) title("Inflation", size(huge)) xtitle("Margin of victory of the challenger", size(vlarge)) ytitle("Value on the year before the election", size(vlarge)) xlabel(-30(10)30, labsize(vlarge) nogrid) ylabel(, labsize(vlarge) nogrid) line(none)  msymbols(circle)
graph export "$project_path/output/appendix_figures/Appendix_Figure_B3b.pdf", as(pdf) name("Graph") replace

* Figure B.3(c)
binscatter unemployment_ilo_1lag runvar if abs(runvar)<=30, nbins(16) legend(off) title("Unemployment", size(huge)) xtitle("Margin of victory of the challenger", size(vlarge)) ytitle("Value on the year before the election", size(vlarge)) xlabel(-30(10)30, labsize(vlarge) nogrid) ylabel(, labsize(vlarge) nogrid) line(none)  msymbols(circle)
graph export "$project_path/output/appendix_figures/Appendix_Figure_B3c.pdf", as(pdf) name("Graph") replace

* Figure B.3(d)
binscatter trade_wb_1lag runvar if abs(runvar)<=30, nbins(16) legend(off) title("Trade intensity", size(huge)) xtitle("Margin of victory of the challenger", size(vlarge)) ytitle("Value on the year before the election", size(vlarge)) xlabel(-30(10)30, labsize(vlarge) nogrid) ylabel(, labsize(vlarge) nogrid) line(none)  msymbols(circle)
graph export "$project_path/output/appendix_figures/Appendix_Figure_B3d.pdf", as(pdf) name("Graph") replace

* Figure B.3(e)
binscatter hdi_1lag runvar if abs(runvar)<=30, nbins(16) legend(off) title("HDI", size(huge)) xtitle("Margin of victory of the challenger", size(vlarge)) ytitle("Value on the year before the election", size(vlarge)) xlabel(-30(10)30, labsize(vlarge) nogrid) ylabel(, labsize(vlarge) nogrid) line(none)  msymbols(circle)
graph export "$project_path/output/appendix_figures/Appendix_Figure_B3e.pdf", as(pdf) name("Graph") replace

* Figure B.3(f)
binscatter democracy_index_1lag runvar if abs(runvar)<=30, nbins(16) legend(off) title("Democracy index", size(huge)) xtitle("Margin of victory of the challenger", size(vlarge)) ytitle("Value on the year before the election", size(vlarge)) xlabel(-30(10)30, labsize(vlarge) nogrid) ylabel(, labsize(vlarge) nogrid) line(none)  msymbols(circle)
graph export "$project_path/output/appendix_figures/Appendix_Figure_B3f.pdf", as(pdf) name("Graph") replace

